package com.elepant.tank;

import java.awt.Graphics;
import java.awt.Rectangle;

public class Explode {
	public static int WIDTH = ResourceImage.explodes[0].getWidth();
	public static int HEIGHT = ResourceImage.explodes[0].getHeight();
	
	private int x, y;
	
	//private boolean living = true;

	private TankFrame tankFrame;
	
	private int step = 0;
	
	public Explode(int x, int y,TankFrame tankFrame) {
		this.x = x;
		this.y = y;
		this.tankFrame =  tankFrame;
		
		new Thread(()->new Audio("audio/explode.wav").play()).start();
	}
	
	

	public void paint(Graphics g) {
		g.drawImage(ResourceImage.explodes[step++], x, y, null);
		if(step >= ResourceImage.explodes.length){
			this.tankFrame.explodes.remove(this);
		}

	}
	
	

}
